Certain services provided by a router are expected to be provided using an internet protocol (IP) address associated with a same subnet as a data compute node (DCN) (e.g., virtual machine, container, namespace, etc.) for which it provides the service. If an IP address that is not in the subnet is used, a data message may be dropped as irrelevant by a switch or DCN expecting a data message from an IP address in the same subnet.
Additionally, services that use an IP address in a subnet used by a switch for which it is providing a service may malfunction if the router that is providing the service does not directly connect to the switch. For example, a source network address translation (SNAT) that uses an IP address in the subnet of the switch results in DCNs attempting resolve the IP address into a MAC address by sending, for example, an address resolution protocol (ARP) request over the switch. However, since the router that is the owner of the translated IP address is not connected to the switch it will never receive the ARP request and will be unable to respond.
Similar problems exist with a load balancing service for a set of server DCNs that are accessed by a client DCN on a same logical switch as the virtual IP (VIP) address of the set of server DCNs. In such a case, a client DCN that tries to resolve the VIP address will not be able to reach the router that is responsible for the VIP address because the router is not on the same switch.